Skip to content

refactor(test): consolidate createFakeBackend factories into shared helper#92

Merged
ThomasK33 merged 2 commits into
mainfrom
refactor/consolidate-fake-backend-helpers
May 11, 2026
Merged

refactor(test): consolidate createFakeBackend factories into shared helper#92
ThomasK33 merged 2 commits into
mainfrom
refactor/consolidate-fake-backend-helpers

Conversation

@ThomasK33
Copy link
Copy Markdown
Member

Summary

  • Introduces test/helpers/fakeBackend.ts exporting a single createFakeBackend() with the union of capabilities needed across all four test files (bootImplementation, resultOverrides, writePng, fail, onScreenshot)
  • Exports FakeRendererBackend type (extends RendererBackend with *Mock accessors and setBooted) so all call sites can inspect mocks without re-declaring the type
  • Migrates all four call sites to the shared helper, removing ~300 lines of duplicated stub code

Closes #81

Test plan

  • All 4 migrated test files pass: test/unit/renderer/registry.test.ts, test/unit/host/renderer.test.ts, test/unit/renderer/libghosttyVtBackend.test.ts, test/unit/screenshot/capture.test.ts
  • Full unit suite: 101 test files, 1071 tests passing

🤖 Generated with Claude Code

ThomasK33 and others added 2 commits May 11, 2026 11:37
…elper

Introduces test/helpers/fakeBackend.ts exporting a single
createFakeBackend() with the union of capabilities needed across all four
test files (bootImplementation, resultOverrides, writePng, fail,
onScreenshot). Migrates all four call sites to the shared helper,
removing ~300 lines of duplicated stub code.

Closes #81

Change-Id: Ie0f6ec7dded45bf11bae732612cb4b581b64a9e9
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Thomas Kosiewski <tk@coder.com>
Re-add RendererBackend import in host/renderer.test.ts (used by the
local BackendFactory type alias) and ScreenshotResult import in
capture.test.ts (used by the it.each type casts). Also apply oxfmt
formatting fixes to the three files flagged by CI.

Change-Id: Iaf9d99786edf4858827c6e930e67563227fe5fa3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33 ThomasK33 merged commit 7271143 into main May 11, 2026
11 checks passed
@ThomasK33 ThomasK33 deleted the refactor/consolidate-fake-backend-helpers branch May 11, 2026 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consolidate createFakeBackend factories into a shared test helper

1 participant